import datetime
from eventcal.eventcal import *
import eventcal.eventcal

def print_examples():
    # Creates different types of calendars as a test
    birthday = Event(u'Happy 20th Birthday!', datetime.datetime(2007, 4, 16),
                     datetime.timedelta(hours=5))
    cal = Calendar()
    cal.add(birthday)
    cal.add(Event(u'Good Friday', datetime.datetime(2007, 4, 1),
                  datetime.timedelta(hours=1)))
    cal.add(Event(u'Sl\xe9\xe9p in', datetime.datetime(2007, 4, 17, 8),
                  datetime.timedelta(hours=5)))
    set_language('en', True)
    print cal.eventlist()
    print cal.compact_dayview(datetime.date(2007, 4, 16))
    print '<html>'
    print '<head><meta http-equiv="Content-Type" content="text/html; charset="UTF-8"></head>'
    print '<body>'
    print '<style>'
    print 'td { text-align: center }'
    print '.dateheader, .daysofweek { text-align: center }'
    print '.noday { background-color: #eef; height: 10px }'
    print '.free { background-color: #c5dbff; width: 30px; height: 10px }'
    print '.busy { background-color: #ffcece; width: 30px; text-align: left; vertical-align: top }'
    print '.daysofweek, .busy, .daynumber { font-size: 8pt }'
    print '</style>'
    print '<h4>Compact Month View</h4>'
    for i in range(1, 4):
        print cal.monthview(1, 2007, True)
    print '<h4>Month View</h4>'
    for i in range(1, 4):
        eventcal.eventcal.mondayToSunday = True
        print cal.monthview(i, 2009)
        eventcal.eventcal.mondayToSunday = False
        print cal.monthview(i, 2009)
    print '<h4>Today</h4>'
    print today(True)
    set_language('pt', True)
    print '<h4>Week of 1 January 2009 (in Portuguese)</h4>'
    print cal.weekview(1, 1, 2009)
    set_language('en', True)
    eventcal.eventcal.mondayToSunday = True
    print '<h4>Week of 5 January 2009 (in English)</h4>'
    print cal.weekview(5, 1, 2009)
    set_language('en', True)
    eventcal.eventcal.mondayToSunday = False
    print '<h4>Week of 5 January 2009 (in English)</h4>'
    print cal.weekview(5, 1, 2009)
    set_language('de', True)
    print '<h4>Week of 1 March 2007 (in German)</h4>'
    print cal.weekview(1, 3, 2007, True)
    print '<h4>Week of 16 April 2007</h4>'
    print cal.weekview(16, 4, 2007)
    print '</body></html>'

if __name__ == '__main__':
    print_examples()
